package com.example.myapplication.bean;

// 定义一个食物类
public class Food {
    // 定义私有成员变量
    private int id;
    private String name;
    private String storeDate;   // 存放日期，格式如 "2025-02-20"
    private String expiryDate;  // 过期日期，格式如 "2025-02-27"
    private int count; // 新增字段

    // 无参构造方法
    public Food() {}
    // 有参构造方法，用来创建该类的对象，并可以通过传入实参，给该对象的私有成员变量赋值
    public Food(int id, String name, String storeDate, String expiryDate, int count) {
        this.id = id;
        this.name = name;
        this.storeDate = storeDate;
        this.expiryDate = expiryDate;
        this.count = count;
    }


    // Getter 与 Setter 方法
    // 获取私有成员变量的值 或 给私有成员变量赋值
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getStoreDate() {
        return storeDate;
    }
    public void setStoreDate(String storeDate) {
        this.storeDate = storeDate;
    }
    public String getExpiryDate() {
        return expiryDate;
    }
    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }
    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }

}
